<template>
  <demo :code-str="codeStr" :code-desc="codeDesc">
    <template #componentName>HPdf</template>
    <template #componentDesc>pdfUrl为必传项，options可自行决定是否要传，options参数参考pdfh5官网。</template>
    <template #component>
      <h-pdf
        ref="pdf"
        pdf-url="http://storage.xuetangx.com/public_assets/xuetangx/PDF/PlayerAPI_v1.0.6.pdf"
        :options="options"
      ></h-pdf>
    </template>
  </demo>
</template>

<script>
export default {
  name: 'MobileV2PdfDemo',
  data() {
    return {
      pdfh5: null,
      options: { pageNum: true },
      codeDesc: '',
      codeStr: `
<template>
  <h-pdf :pdf-url="pdfUrl" :options="options"></h-pdf>
<\/template>
<script>
  import HPdf from 'hztech.common';
  export default {
    components: { HPdf },
    data() {
      return {
        pdfh5: null
        pdfUrl: 'http://storage.xuetangx.com/public_assets/xuetangx/PDF/PlayerAPI_v1.0.6.pdf',
        options: { pageNum: true },
      }
    },
    mounted() {
      setTimeout(() => {
        this.pdfh5 = this.$refs.pdf.getInstance()
        this.pdfh5.scrollEnable(false)
        this.pdfh5.on("ready", function () {
          console.log("总页数：" + this.totalNum)
        })
      }, 500)
    }
  }
<\/script>
`
    };
  },
  mounted() {
    setTimeout(() => {
      this.pdfh5 = this.$refs.pdf.getInstance()
      this.pdfh5.scrollEnable(false)
      this.pdfh5.on("ready", function () {
        console.log("总页数：" + this.totalNum)
      })
    }, 500)
  }
};
</script>

<style>
</style>